home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / boot.zip / BOOT.DOC < prev    next >
Text File  |  1986-01-09  |  7KB  |  139 lines

  1.                     Custom-Made Boot Messages
  2.     (PC Magazine Vol 5 No 2 January 28, 1986 by Peter Norton)
  3.  
  4.      A problem arises when you send out nonsystem disks to people who
  5. may not be experienced enough with their PCs to know the difference
  6. between ordinary disks and the boot disks you use to start your
  7. computer.  If someone starts up his computer with an ordinary disk --
  8. one that doesn't contain the DOS system files -- he gets a message
  9. such as: "Non-system disk or disk error.  Replace and strike any key
  10. when ready."  While that's certainly not the most technical and
  11. confusing message you've seen, it's also not very helpful to PC
  12. beginners who may not know what system disks and disk errors are.
  13.  
  14.      For the disks I send out to customers, I decided it would be nice
  15. to display a less intimidating message that would provide at least a
  16. little more helpful information.  So I created my own boot record
  17. program to display something more reassuring.  The program can be
  18. useful to user groups, which distribute thousands of public-domain
  19. diskettes, and others.  Lots of these disks go to those who are just
  20. learning how to use their computers.  It's nice to have a user-friendly
  21. message that identifies what disk they have and tells them what went
  22. wrong.
  23.  
  24.      The boot program you create will display a series of messages,
  25. giving the user whatever information you want.  In my case, I tell
  26. users the name of the product, so they know what they've got, and then
  27. what they need to do.  The program then waits for a keystroke and
  28. reboots the computer.
  29.  
  30.      Three files are used.  The first file, BOOTMAKE.BAT (see below),
  31. is a regular DOS batch file that automates the process.  It assembles
  32. the boot program and converts it into the proper format, first by
  33. linking it and then (with EXE2BIN) by converting it from an .EXE to
  34. a .COM format.  Next comes the key step, which uses DEBUG to transfer
  35. this program onto a diskette's boot record.  The batch file finishes
  36. up by deleting the extraneous files that were created along the way.
  37.  
  38.      To automate the command sequence that tells DEBUG to transfer the
  39. boot program onto a prospective user's diskette, you use BOOT.DBG,
  40. which consists of two lines:
  41.  
  42. W 100 0 0 1
  43. Q
  44.  
  45. BOOT.DBG provides DEBUG with the commands that write the boot record
  46. onto a diskette.  BOOTMAKE.BAT uses DOS's redirection facility to pass
  47. these commands to DEBUG; in order for this to work, of course, you'll
  48. have to have these commands stored in the right filename.  The first
  49. command in BOOT.DBG writes (W) from memory location hext 100 (where
  50. the boot program has been loaded) to the A: drive's (0) first or boot
  51. sector (0) for a length of one sector (1).
  52.  
  53.      BOOTMAKE.BAT and BOOT.DBG take the labor out of creating your
  54. custom boot record. The part that's really interesting is the assembler
  55. program (BOOT.ASM) that creates the boot record itself.
  56.  
  57.      BOOT.ASM begins with a jump past some data that describes the
  58. disk's format.  All the disk formats introduced since DOS 2.0 have this
  59. descriptive information in them.  Since my boot record is set up for
  60. the PC's lowest common denominator, the single-sided, eight-sector
  61. diskette (a DOS 1.0 format), this information isn't needed.  I included
  62. it partly out of compulsive tidiness and partly to show what is needed
  63. for other disk formats.  If you set up a custom boot record for another
  64. format, substitute the appropriate information in these fields.  The
  65. best way to find out what belongs here is simply to inspect the
  66. standard boot record on the disk format you're interested in; you can
  67. use DEBUG or Norton Utilities' snooping tool to see what the right
  68. data is.
  69.  
  70.      Next comes the program that makes this boot record work.  The
  71. first three instructions (following the label "begin") give the
  72. program addressing access to its own data.  The hex value 07C0 is used
  73. because that's the memory segment paragraph address where the PC loads
  74. the boot program.
  75.  
  76.      Following that is a short program that displays whatever messages
  77. you want to show. The assembler code is set up so that it automatically
  78. adjusts to the size of whatever messages you substitute for the ones
  79. used.  The program through "loop continue" does the work of displaying
  80. the message.
  81.  
  82.      The next two lines of the program simply read a character from the
  83. keyboard.  This makes the program pause so that the user can read the
  84. messages.  After a key is pressed, the program proceeds to clear the
  85. screen and then reboot the computer.  The screen is cleared by using a
  86. simple trick: It tells the computer to change the video mode (the
  87. format of the display screen), which always causes the screen to clear;
  88. to avoid disrupting anything, we first find out what the current mode
  89. is and then "change" it to the same mode.
  90.  
  91.      Following that simple bit of programming comes the messages to be
  92. displayed.  You can substitute your own messages for the ones used in
  93. BOOT.ASM.  Those used give you all the clues you need to set up yours.
  94. The lines that read "0Dh,0Ah" are the return carriage and line feed
  95. characters needed to move from one display line to another.  All the
  96. messages fit within 40 characters in case the computer starts up in
  97. 40-column mode (as the PCjr does), but that really isn't necessary.
  98. If you want to position your messages further across the screen, you
  99. can use the tab character, 09h, to substitute for a bunch of spaces.
  100. About the only thing you have to be careful with is not to make your
  101. messages too long to fit.  You'll have 424 bytes to hold your messages.
  102.  
  103.      After the messages that you place in the boot record come a few
  104. assembler statements that count how much space is left in the 512-byte
  105. boot record; fill it out with padding, and finish the record off with
  106. a standard 2-byte signature, hex 55 AA.
  107.  
  108.      With this simple program, you'll be able to create your own custom
  109. boot record messages to help and guide anyone who tries to start his
  110. computer with your diskette.
  111.  
  112.      There is one minor flaw in this custom boot record.  On some PCs
  113. -- it seems only to be old-model machines with the earliest ROM BIOS
  114. and those that use only the color/graphics adapter (and some Compaqs)
  115. -- only part of the messages are displayed.  In such cases the rest of
  116. the program, which waits for a keystroke, clears the screen and
  117. reboots, works fine, but only about half of the message lines appear
  118. on the screen.
  119.  
  120. - - - - -
  121. BOOTMAKE.BAT:
  122.  
  123. rem   This batch file will
  124. rem     1) assemble boot.asm
  125. rem     2) link it into boot.exe
  126. rem     3) convert it into boot.com
  127. rem     4) copy it to the boot record
  128. rem        in a diskette in drive A
  129. rem        (be prepared for that)
  130. rem     5) delete extraneous files
  131. pause  Ready?
  132. masm boot,boot.obj,nul,nul
  133. link boot,boot,con;
  134. exe2bin boot.exe boot.com
  135. debug boot.com <boot.dbg
  136. del boot.obj
  137. del boot.exe
  138. del boot.com
  139.